#ifndef SEATDETECTION_H
#define SEATDETECTION_H
#include <QString>
#include <QVector>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include <QFile>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonValue>

#include "imageinfo.h"
#include "cnninfo.h"
#include "camerainfo.h"
#include "categoryinfo.h"
#include "detectionwindowinfo.h"
#include "baseinfo.h"
#include "../description/description.h"

class SeatDetection
{
public:
    SeatDetection();

    SeatDetection& operator= (SeatDetection& a);

private:
    BaseInfo                m_objBaseInfo;
    ImageInfo               m_objImageInfo;
    CnnInfo                 m_objCnnInfo;
    DetectionWindowInfo     m_objDetectionWindowInfo;
    QVector<CameraInfo>     m_vecCameraInfos;
    QVector<CategoryInfo>   m_vecCategoryInfos;
    Description             m_objDescription;

public:
    void                    AppendCameraInfo(CameraInfo& ci){
        m_vecCameraInfos.append(ci);
    }

    void                    RemoveCameraInfo(int index){
        m_vecCameraInfos.removeAt(index);
    }

    void                    ReplaceCameraInfo(int index,CameraInfo& ci){
        m_vecCameraInfos.replace(index,ci);
    }

    void                    SwapCameraInfo(int first,int second){
        m_vecCameraInfos.swapItemsAt(first,second);
    }

    void                    AppendCategoryInfo(CategoryInfo& ci){
        m_vecCategoryInfos.append(ci);
    }

    void                    RemoveCategoryInfo(int index){
        m_vecCategoryInfos.removeAt(index);
    }

    void                    ReplaceCategoryInfo(int index,CategoryInfo& ci){
        m_vecCategoryInfos.replace(index,ci);
    }

    void                    SwapCategoryInfo(int first,int second){
        m_vecCategoryInfos.swapItemsAt(first,second);
    }


public:
    BaseInfo&               GetBaseInfo();
    ImageInfo&              GetImageInfo();
    CnnInfo&                GetCnnInfo();
    DetectionWindowInfo&    GetDetectionWindowInfo();
    Description&            GetDescription();
    QVector<CameraInfo>&    GetCameraInfos();
    QVector<CategoryInfo>&  GetCategoryInfos();

public:
    bool writeXML(const QString &filePath);
    bool ReadXML(const QString &filePath);

private:
    bool ReadCamerasXML(QXmlStreamReader &reader);
    bool ReadCategoriesXML(QXmlStreamReader &reader);
    bool WriteCamerasXML(QXmlStreamWriter &writer);
    bool WriteCategoriesXML(QXmlStreamWriter &writer);
};

#endif // SEATDETECTION_H
